﻿param($resultsFilesPath,$pattern)

$results=Get-ChildItem $resultsFilesPath\*.xml

$computerMatches=@()

foreach($result in $results)
{
    $matches=Get-Content -Path $result | Select-String -SimpleMatch $pattern

    if($matches -ne $null)
    {
        $computerName=$result.Name.Split("_")[0]
        Write-Host "Matched $computerName"
        $computerMatches+=$computerName
    }
}

$computerMatches